package online.heycm.platform.common.tools.cipher;

import cn.hutool.crypto.asymmetric.RSA;
import online.heycm.platform.common.tools.cipher.core.RSACore;

/**
 * @author heycm
 * @since 2023/11/19 19:07
 */
public class RSAEncrypt {

    private final RSA rsa;

    public RSAEncrypt(RSA rsa) {
        this.rsa = rsa;
    }

    public RSAEncrypt(String privateKey, String publicKey) {
        rsa = RSACore.rsa(privateKey, publicKey);
    }

    public String encrypt(String content) {
        return RSACore.encrypt(this.rsa, content);
    }

    public String decrypt(String encrypt) {
        return RSACore.decrypt(this.rsa, encrypt);
    }
}
